import { createRouter, createWebHistory } from "vue-router";
import Guanyu from "../components/guanyu.vue";
import Xinwen from "../components/xinwen.vue";
import Zhuye from "../components/zhuye.vue";
import Danwj from "../components/danwj.vue";
import Duowj from "../components/duowj.vue";
import Dawj from "../components/dawj.vue";
import Detail from "../components/Detail.vue";
const routes = [
  {
    name: 'zhuye',
    path: '/zhuye',
    component: Zhuye,
  },
  {
    name: 'xinwen',
    path: '/xinwen',
    component: Xinwen,
    children: [
      {
        name: 'detail',
        path: 'detail/:id/:title/:content',
        component: Detail,
        // props: true
        props(route: any) {
          return route.params
        }
      }
    ]
  },
  {
    name: 'guanyu',
    path: '/guanyu',
    component: Guanyu
  },
  {
    name: 'danwj',
    path: '/danwj',
    component: Danwj
  },
  {
    name: 'duowj',
    path: '/duowj',
    component: Duowj
  },
  {
    name: 'dawj',
    path: '/dawj',
    component: Dawj
  },
  {
    path: '/',
    redirect: '/shouye'
  }
]
const router = createRouter({
  history: createWebHistory(),// 路有工作模式
  routes: routes
})
export default router